The mathfig
program, for use on UNIX systems, takes a
Mathematica source file foo.m
and calls Mathematica to create
a PostScript file foo.ps
.
Then mathfig
postprocesses foo.ps
to
take out the PostScript labels putting the same information in a file
foo.lab
that can be read later by , as explained in
PostScript Figures. The usage of this program is the following:
-d
option makes all file names relative to the specified
directory. The -i
option tells Mathematica to read an
initialization file. Any number of files can be passed as subsequent
argument; \mathfig
processes one at a time, starting a new
Mathematica session each time.
The steps performed by mathfig
when processing the file
foo.m
are the following. It calls math
and gives it the
commands Get["
initfile"]
(if an initialization
file was specified) and Get["foo.m"]
. The result of
Get["foo.m"]
should be an expression with head Graphics
or Graphics3D
. This expression is passed to Display
,
with output sent to the filter geomfix
; this filter is
analogous to the psfix
program supplied with Mathematica. The
output of geomfix
is further processed to create the files
foo.ps
and foo.lab
. This last step is performed by
mathlabels
, a perl
program. (perl
is a widely
used UNIX utility, and it should be available at your site. If
mathfig
claims that mathlabels
cannot be found, it may
be because perl
is not where mathfig
expects to find it;
see the end of Installation.)
By default, \mathfig
creates a figure two inches high and five
inches wide. A different height can be specified by including the
assignment $height=
height in the Mathematica source file,
where height is a number specifying the height in inches. You
can also say $width=
width. The reason to put these numbers
in the source file, rather than choosing them at run time, is
archival: in this way the output is entirely determined by the
contents of the source file.
to *Furthermore, if you assign values to the variables $xlo
,
$xhi
, $ylo
and $yhi
, the figure produced by
Mathematica will be clipped to a window with the given boundaries, and
rescaled so as to fit in a box of the given height and width. For
example, setting $xlo=$ylo=.1
and $xhi=$yhi=.9
will trim
10% off the size of the box around each edge, and the remaining
graphics will be rescaled by a factor of
1/(.9 - .1) = 1.25. Under
Mathematica 1.2, this is the only way I know to make a 3D-graphics
object occupy the whole bounding box. Unfortunately the values of
$xlo
and so on have to be determined by trial and error.
The symbols $height
, $width
, $xlo
, $ylo
,
$xhi
, $yhi
and $Def
should not be used in your
Mathematica source file except with the meanings described above.
($Def
is used internally.)
When Mathematica generates a picture with labels, the scaling computations are implicit in the resulting PostScript code, and they take into account the dimensions of the labels present in the code. Thus the graph generated by
Plot[x,{x,0,1}]looks a bit smaller on the screen than the one generated by
Plot[x,{x,0,1},Ticks->False]because the first has to accomodate labels along the axes, in the same size window. However, when you run
mathfig
, the labels are
taken out of the PostScript file, and therefore don't have any effect
on the scaling of the picture. The mathfig
output for the two
commands above would be scaled by exactly the same amount, and the
TEX labels generated for the first command would stick out of the
bounding box a little bit, just as they do in PStorus.